package site.xuxingcan.ninecut.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import java.util.ArrayList;

import site.xuxingcan.ninecut.R;

/**
 * Created by xuxingcan on 16-5-13.
 */
public class HorizontalListViewAdapter extends BaseAdapter {
    private Context mContext;
    private ArrayList<Integer> list;

    public HorizontalListViewAdapter(Context mContext, ArrayList<Integer> list) {
        this.mContext = mContext;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.horizontal_item, parent, false);
            convertView.setTag(convertView.findViewById(R.id.image));
        }
        ((ImageView) convertView.getTag()).setImageResource(list.get(position));
        return convertView;
    }
}
